//
//  CHReservationDetailController.m
//  CarFile
//
//  Created by 陈浩 on 2018/1/24.
//  Copyright © 2018年 陈浩. All rights reserved.
//

#import "CHReservationDetailController.h"

@interface CHReservationDetailController ()
@property (weak, nonatomic) IBOutlet UILabel *ordernumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *carnameLabel;
@property (weak, nonatomic) IBOutlet UILabel *kilometerLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *carnoLabel;
@property (weak, nonatomic) IBOutlet UILabel *projectLabel;
@property (weak, nonatomic) IBOutlet UILabel *linkmanLabel;
@property (weak, nonatomic) IBOutlet UILabel *remarkLabel;
@property (weak, nonatomic) IBOutlet UITextView *replaycontentLabel;

@end

@implementation CHReservationDetailController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"预约详情";
    self.replaycontentLabel.layer.cornerRadius = 3;
    self.replaycontentLabel.layer.masksToBounds = YES;
    
    [self getData];
}

-(void)getData{
    
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    params[@"areaid"] = _model.areaid;
    params[@"orderid"] = _model.orderid;
    params[@"years"] = _model.years;
    params[@"usertype"] = [Util getValue:@"usertype"];
    params[@"user"] = [Globle getInstance].user;
    params[@"sign"] = [DESCript encrypt:_model.orderid encryptOrDecrypt:kCCEncrypt key:[Globle getInstance].key];

    [[Globle getInstance].service requestWithServiceName:@"lcipappgovsearchorderinfo" params:params httpMethod:@"POST" resultIsDictionary:YES completeBlock:^(id result) {
        
        if (!result)   return ;
        
        if ([result[@"code"] isEqualToString:@"1"]) {
            NSDictionary *dict = result[@"data"];
            self.ordernumberLabel.text = [NSString stringWithFormat:@"订单编号：%@",dict[@"ordernumber"]];
            self.kilometerLabel.text =[NSString stringWithFormat:@"%@KM",dict[@"kilometer"]];
            
            NSArray *timeArr = [dict[@"time"] componentsSeparatedByString:@" "];
            self.timeLabel.text = timeArr[0];
            self.projectLabel.text = dict[@"project"];
            self.carnameLabel.text = dict[@"carname"];
            self.carnoLabel.text = dict[@"carno"];
            self.linkmanLabel.text = dict[@"linkman"];
    
            self.remarkLabel.text = [dict[@"remarks"] length] >0 ? dict[@"remarks"] : @"暂无留言";
            self.replaycontentLabel.text = [dict[@"replaycontent"] length] >0 ? dict[@"replaycontent"] : @"暂无回复";
        }
  
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
